package com.zbb.order.api;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zbb.base.model.Result;
import com.zbb.order.mapper.LabelMapper;
import com.zbb.order.mapper.OrderInitiateMapper;
import com.zbb.order.mapper.OrderSnapshotMapper;
import com.zbb.order.model.dto.InsertOrderDto;
import com.zbb.order.model.po.Label;
import com.zbb.order.model.po.OrderInitiate;
import com.zbb.order.model.po.OrderSnapshot;
import com.zbb.order.service.InsertOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@Slf4j
@RestController
@Api(value = "发起求助订单接口",tags = "发起求助订单/获取信息接口")
public class OrderAddController {

    @Autowired
    LabelMapper labelMapper;

    @Autowired
    OrderInitiateMapper orderInitiateMapper;

    @Autowired
    OrderSnapshotMapper orderSnapshotMapper;

    @Autowired
    InsertOrderService insertOrderService;

    @ApiOperation("发起求助订单详情查询接口")
    @GetMapping("/addOrder/labelList")
    public Result labelList(){
        List<Label> labels = labelMapper.selectList(null);
        return Result.ok(labels);
    }

    @ApiOperation("新增求助订单")
    @PostMapping("addOrder/insertOrder")
    public Result insertOrder(@RequestBody InsertOrderDto insertOrderDto){

        Result result = insertOrderService.insertOrder(insertOrderDto);

        return result;
    }

}
